package org.hegang.design.first.abstractfactorypattern;

import org.hegang.design.common.CommonFields;

/**
 * @ClassName FactoryProducter
 * @Describe: 工厂生成器
 * @Author: gang.he
 * @Email: SmileSkylife@outlook.com
 * @Date: Created in 23:01 2019/6/28
 * @Modified By:
 * @Version V1.0
 */
public class FactoryProducter {
    public static AbstractFactory getFactory(String factoryType){
        if (null == factoryType){
            return null;
        }
        if (factoryType.trim().equalsIgnoreCase(CommonFields.SHAPE)){
            return new ShapeFactory();
        }else if (factoryType.trim().equalsIgnoreCase(CommonFields.COLOR)){
            return new ColorFactory();
        }
        return null;
    }
}
